import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FollowStatusVO, FollowStatusForm, FollowStatusQuery } from '@/api/goods/followStatus/types';

/**
 * 查询跟单状态列表
 * @param query
 * @returns {*}
 */

export const listFollowStatus = (query?: FollowStatusQuery): AxiosPromise<FollowStatusVO[]> => {
  return request({
    url: '/order/followStatus/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询跟单状态详细
 * @param id
 */
export const getFollowStatus = (id: string | number): AxiosPromise<FollowStatusVO> => {
  return request({
    url: '/order/followStatus/' + id,
    method: 'get'
  });
};

/**
 * 新增跟单状态
 * @param data
 */
export const addFollowStatus = (data: FollowStatusForm) => {
  return request({
    url: '/order/followStatus',
    method: 'post',
    data: data
  });
};

/**
 * 修改跟单状态
 * @param data
 */
export const updateFollowStatus = (data: FollowStatusForm) => {
  return request({
    url: '/order/followStatus',
    method: 'put',
    data: data
  });
};

/**
 * 删除跟单状态
 * @param id
 */
export const delFollowStatus = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/followStatus/' + id,
    method: 'delete'
  });
};

export default {
  list: listFollowStatus,

  get: getFollowStatus,

  add: addFollowStatus,
  update: updateFollowStatus,

  del: delFollowStatus,
}